Skip to content

Conversation

@kumarUjjawal
Copy link
Contributor

@kumarUjjawal kumarUjjawal commented Jan 7, 2026

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Yes

Are there any user-facing changes?

@github-actions github-actions bot added the datasource Changes to the datasource crate label Jan 7, 2026
@kumarUjjawal
Copy link
Contributor Author

cc @kosiew

@kumarUjjawal kumarUjjawal force-pushed the refactor/btree_to_vec branch from 9e5d7ba to 8c2462e Compare January 8, 2026 07:42
Copy link
Contributor

@kosiew kosiew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kumarUjjawal for contributing.
I left some comments for your consideration.

Unsupported,
}

#[derive(Debug)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to remove
#[derive(Debug)]
?

Comment on lines 310 to 312
if !self.required_columns.contains(&idx) {
self.required_columns.push(idx);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would help future contributors to

  • Add comment explaining linear search is acceptable for small n
    • OR switch to HashSet for O(1) deduplication if n might grow

Comment on lines 415 to 418
let prevents_pushdown = checker.prevents_pushdown();
let nested = checker.nested_behavior;
let mut required_columns = checker.required_columns;
required_columns.sort_unstable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about adding:

impl PushdownChecker {
    fn into_sorted_columns(mut self) -> PushdownColumns {
        self.required_columns.sort_unstable();
        self.required_columns.dedup(); // this removes the need for contains check
        PushdownColumns {
            required_columns: self.required_columns,
            nested: self.nested_behavior,
        }
    }

Comment on lines 419 to 422
Ok((!prevents_pushdown).then_some(PushdownColumns {
required_columns,
nested,
}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and then rewriting this to:

Ok((!checker.prevents_pushdown())
    .then_some(checker.into_sorted_columns()))

Comment on lines 310 to 312
if !self.required_columns.contains(&idx) {
self.required_columns.push(idx);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see suggested

fn into_sorted_columns
below

@kumarUjjawal
Copy link
Contributor Author

Thanks @kumarUjjawal for contributing. I left some comments for your consideration.

Thanks for the feedback. Incorporated the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

datasource Changes to the datasource crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize required_columns from BTreeSet<usize> to Vec<usize> in struct PushdownChecker<'schema>

2 participants